package com.by.component.importrecord.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;

@Getter
@AllArgsConstructor
public enum ImportTypeEnum {

    PHYSICAL_ORDER_LOGISTIC_STATUS(ImportTypeEnum.PHYSICAL_ORDER_LOGISTIC_STATUS_CODE, "实物订单物流状态"),
    PHYSICAL_ORDER_LOGISTIC_NO(ImportTypeEnum.PHYSICAL_ORDER_LOGISTIC_NO_CODE, "实物订单-物流单号"),
    ;

    private Integer code;
    private String desc;

    private static final Map<Integer, ImportTypeEnum> MAP = Arrays.stream(ImportTypeEnum.values())
            .collect(Collectors.toMap(ImportTypeEnum::getCode, Function.identity()));

    public static ImportTypeEnum resolve(Integer code) {
        return MAP.get(code);
    }

    public static final int PHYSICAL_ORDER_LOGISTIC_STATUS_CODE = 1;
    public static final int PHYSICAL_ORDER_LOGISTIC_NO_CODE = 2;

}
